﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using DragonSolution.Web.Data.Entity;

namespace DragonSolution.Web.UI.DAL
{
    public class MyDbContext: DbContext
    {
        public MyDbContext() : base("MyDbContext") { }

        public DbSet<Category> Category { get; set; }
        public DbSet<CompanyInfo> CompanyInfo { get; set; }
        public DbSet<Feedback> Feedback { get; set; }
        public DbSet<NewsInfo> NewsInfo { get; set; }
        public DbSet<Attachment> Attachment { get; set; }
        public DbSet<ProductInfo> ProductInfo { get; set; }
        public DbSet<UserInfo> UserInfo { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //prevents table names from being pluralized(防止生成的数据库表名称是复数形式，如Students)
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}